package com.silvtar.sync.model;

public class SyncItem {

    private String  localPath;     // 本地路径
    private String  remotePath;    // 远程目录
    private String  remoteModel;   // 远程模块
    
    private boolean listen = false; // 是否监听
    private boolean usingMoment = false;      // 是否启用定时同步
    private boolean usingInterval = false;     // 是否启用间隔同步
    
    private String  moment;      // 同步时刻
    private long listenReturnTime;
    private long  interval;    // 同步间隔

    /**
     * 以本地路径来构造
     * @param localPath 同步文件夹在本地计算机上的路径
     */
    public SyncItem(String localPath) {
        this.localPath = localPath;
    }

    public String getLocalPath() {
        return localPath;
    }

    public void setLocalPath(String localPath) {
        this.localPath = localPath;
    }

    public String getRemotePath() {
        return remotePath;
    }

    public void setRemotePath(String remotePath) {
        this.remotePath = remotePath;
        remoteModel = remotePath.substring(remotePath.lastIndexOf("/") + 1);
    }
    
    public String getRemoteModel() {
        return remoteModel;
    }

    public boolean isListen() {
        return listen;
    }

    public void setListenReturnTime(long returnTime) {
        this.listen = true;
        this.listenReturnTime = returnTime;
    }

    public long getListenReturnTime() {
        return listenReturnTime;
    }

    public String getMoment() {
        return moment;
    }

    public void setMoment(String moment) {
        if (moment.equals("false")) {
            return;
        }
        usingMoment = true;
        this.moment = moment;
    }

    public long getInterval() {
        return interval;
    }

    public void setInterval(long interval) {
        usingInterval = true;
        this.interval = interval;
    }
    
    public void setInterval(String interval) {
        if (interval.equals("false")) {
            return;
        }
        usingInterval = true;
        this.interval = Integer.parseInt(interval);
    }

    public boolean isUsingMoment() {
        return usingMoment;
    }

    public boolean isUsingInterval() {
        return usingInterval;
    }
    

}
